//
//  Bolt.m
//  ARPlay
//
//  Created by Hao on 2017/8/20.
//  Copyright © 2017年 Hao. All rights reserved.
//

#import "Bolt.h"

static SCNAudioSource *source;
@implementation Bolt
- (void)fire {
    @autoreleasepool {
    SCNParticleSystem *sys = [SCNParticleSystem particleSystemNamed:@"FirePartical" inDirectory:nil];
    [self addParticleSystem:sys];
    [self removeAllAudioPlayers];
    static dispatch_once_t onceToken;
    dispatch_once(&onceToken, ^{
        source = [SCNAudioSource audioSourceNamed:@"weapon_player.wav"];
        source.positional=YES;
        source.volume=0.5;
        [source load];
    });
    [self addAudioPlayer:[SCNAudioPlayer audioPlayerWithSource:source]];
    }
}
@end
